using Kooboo.Json;

namespace 修为尽失.辅助
{
    
    public static class Json
    {
    

        public static string Write<T>(T t,bool pretty=false,JsonSerializerOption option=null)
        {
            var a = JsonSerializer.ToJson(t,option); 
            return pretty ? JsonFormatterPlus.JsonFormatter.Format(a) : a;
        }

        public static T Read<T>(string s)
        {
            return s == null ? default : JsonSerializer.ToObject<T>(s);
        }
    }
}